CXX= g++
LXX= g++ 

CXXFLAGS= -Wall -pipe -g -I/u/derousic/Developement/Simple/simpl3/ -I/u/derousic/Apps/local/include
LXXFLAGS= -lm -lGL -lGLU -lglut -L/u/derousic/Apps/local/lib -lGLEW -lIL -lILU
# variables de configuration pour l'utilisation des differentes librairies :
# pour utiliser une librairie supplementaire (apres l'avoir installee) enlevez
# commentaires (les #) devant les lignes CFLAGS+= ... et LDFLAGS+= ...


CORE 	  = main
GEOMETRY  = Light Loader Mesh PredefinedShape
RENDERING = Camera Enumeration FrameBuffer Renderer RessourcesProxy Shader Texture
TOOLS     = Log
MATH      = Matrix
LIBS      = rply rgbe


CORE_OBJS       := $(addprefix objs/, $(CORE:=.o))
GEOMETRY_OBJS   := $(addprefix objs/, $(GEOMETRY:=.o))
RENDERING_OBJS  := $(addprefix objs/, $(RENDERING:=.o))
TOOLS_OBJS      := $(addprefix objs/, $(TOOLS:=.o))
MATH_OBJS	:= $(addprefix objs/, $(MATH:=.o))
LIBS_OBJS	:= $(addprefix objs/, $(LIBS:=.o))

# construction du projet
simple: $(CORE_OBJS) $(GEOMETRY_OBJS) $(RENDERING_OBJS) $(TOOLS_OBJS) $(MATH_OBJS) $(LIBS_OBJS)
	$(LXX) $(LXXFLAGS) -o $@ $+

objs/%.o: %.cpp
	@echo "Building Core \"$*\""
	@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/%.o: Geometry/%.cpp
	@echo "Building Geometry \"$*\""
	@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/%.o: Rendering/%.cpp 
	@echo "Building Rendering \"$*\""
	@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/%.o: Tools/%.cpp 
	@echo "Building Tools \"$*\""
	@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/%.o: Math/%.cpp 
	@echo "Building Math \"$*\""
	@$(CXX) $(CXXFLAGS) -o $@ -c $<

# Special rule for Rply loader library
objs/%.o: Libs/%.cpp
	@echo "Building Libs \"$*\""
	@$(CXX) $(CXXFLAGS) -o $@ -c $<

objs/%.o: Libs/%.c
	@echo "Building Libs \"$*\""
	@gcc -Wall -pipe -c $< -o $@

.PHONY: clean
clean:
	rm -f */*.o  bin/simple
